#pragma once
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
#pragma clang diagnostic warning "-Wextra"
#pragma clang diagnostic warning "-Wall"
#include "recorder.Response.napi.decl.h"
#include "recorder.Response.proj.2.hpp"
#pragma clang diagnostic ignored "-Wmissing-braces"
static napi_value recorder_Response_code_getter(napi_env env, napi_callback_info info) {
    napi_value thisobj;
    NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisobj, nullptr));
    ::recorder::Response* cpp_ptr;
    NAPI_CALL(env, napi_unwrap(env, thisobj, reinterpret_cast<void **>(&cpp_ptr)));
    napi_value napi_field_result = nullptr;
    NAPI_CALL(env, napi_create_int32(env, cpp_ptr->code, &napi_field_result));
    return napi_field_result;
}
static napi_value recorder_Response_code_setter(napi_env env, napi_callback_info info) {
    size_t argc = 1;
    napi_value args[1] = {nullptr};
    napi_value thisobj;
    NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &thisobj, nullptr));
    ::recorder::Response* cpp_ptr;
    NAPI_CALL(env, napi_unwrap(env, thisobj, reinterpret_cast<void **>(&cpp_ptr)));
    int32_t cpp_field_result_tmp;
    NAPI_CALL(env, napi_get_value_int32(env, args[0], &cpp_field_result_tmp));
    int32_t cpp_field_result = cpp_field_result_tmp;
    cpp_ptr->code = cpp_field_result;
    return nullptr;
}
static napi_value recorder_Response_surfaceId_getter(napi_env env, napi_callback_info info) {
    napi_value thisobj;
    NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisobj, nullptr));
    ::recorder::Response* cpp_ptr;
    NAPI_CALL(env, napi_unwrap(env, thisobj, reinterpret_cast<void **>(&cpp_ptr)));
    napi_value napi_field_result = nullptr;
    NAPI_CALL(env, napi_create_string_utf8(env, cpp_ptr->surfaceId.c_str(), cpp_ptr->surfaceId.size(), &napi_field_result));
    return napi_field_result;
}
static napi_value recorder_Response_surfaceId_setter(napi_env env, napi_callback_info info) {
    size_t argc = 1;
    napi_value args[1] = {nullptr};
    napi_value thisobj;
    NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &thisobj, nullptr));
    ::recorder::Response* cpp_ptr;
    NAPI_CALL(env, napi_unwrap(env, thisobj, reinterpret_cast<void **>(&cpp_ptr)));
    size_t cpp_field_result_len = 0;
    NAPI_CALL(env, napi_get_value_string_utf8(env, args[0], nullptr, 0, &cpp_field_result_len));
    TString cpp_field_result_abi;
    char* cpp_field_result_buf = tstr_initialize(&cpp_field_result_abi, cpp_field_result_len + 1);
    NAPI_CALL(env, napi_get_value_string_utf8(env, args[0], cpp_field_result_buf, cpp_field_result_len + 1, &cpp_field_result_len));
    cpp_field_result_buf[cpp_field_result_len] = '\0';
    cpp_field_result_abi.length = cpp_field_result_len;
    taihe::string cpp_field_result(cpp_field_result_abi);
    cpp_ptr->surfaceId = cpp_field_result;
    return nullptr;
}
inline napi_value recorder_Response_constructor_inner(napi_env env, napi_callback_info info) {
    napi_status _status;
    napi_value thisobj;
    size_t argc = 2;
    napi_value args[2];
    NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &thisobj, nullptr));
    int32_t cpp_field_code_tmp;
    NAPI_CALL(env, napi_get_value_int32(env, args[0], &cpp_field_code_tmp));
    int32_t cpp_field_code = cpp_field_code_tmp;
    size_t cpp_field_surfaceId_len = 0;
    NAPI_CALL(env, napi_get_value_string_utf8(env, args[1], nullptr, 0, &cpp_field_surfaceId_len));
    TString cpp_field_surfaceId_abi;
    char* cpp_field_surfaceId_buf = tstr_initialize(&cpp_field_surfaceId_abi, cpp_field_surfaceId_len + 1);
    NAPI_CALL(env, napi_get_value_string_utf8(env, args[1], cpp_field_surfaceId_buf, cpp_field_surfaceId_len + 1, &cpp_field_surfaceId_len));
    cpp_field_surfaceId_buf[cpp_field_surfaceId_len] = '\0';
    cpp_field_surfaceId_abi.length = cpp_field_surfaceId_len;
    taihe::string cpp_field_surfaceId(cpp_field_surfaceId_abi);
    ::recorder::Response* cpp_ptr = new ::recorder::Response{std::move(cpp_field_code), std::move(cpp_field_surfaceId)};
    _status = napi_wrap(env, thisobj, cpp_ptr, []([[maybe_unused]] napi_env env, void* finalize_data, [[maybe_unused]] void* finalize_hint) {
        delete static_cast<::recorder::Response*>(finalize_data);
    }, nullptr, nullptr);
    if (_status != napi_ok) {
        delete thisobj;
        napi_throw_error(env,
            "ERR_WRAP_FAILED",
            ("Native object wrapping failed (status " + std::to_string(_status) + ")").c_str()
        );
        return nullptr;
    }
    return thisobj;
}
inline napi_ref& ctor_ref_recorder_Response_t_inner() {
    static napi_ref instance = nullptr;
    return instance;
}
inline ::recorder::Response recorder_Response_fromNAPI(napi_env env, napi_value napi_obj) {
    napi_value napi_field_code = nullptr;
    NAPI_CALL(env, napi_get_named_property(env, napi_obj, "code", &napi_field_code));
    int32_t cpp_field_code_tmp;
    NAPI_CALL(env, napi_get_value_int32(env, napi_field_code, &cpp_field_code_tmp));
    int32_t cpp_field_code = cpp_field_code_tmp;
    napi_value napi_field_surfaceId = nullptr;
    NAPI_CALL(env, napi_get_named_property(env, napi_obj, "surfaceId", &napi_field_surfaceId));
    size_t cpp_field_surfaceId_len = 0;
    NAPI_CALL(env, napi_get_value_string_utf8(env, napi_field_surfaceId, nullptr, 0, &cpp_field_surfaceId_len));
    TString cpp_field_surfaceId_abi;
    char* cpp_field_surfaceId_buf = tstr_initialize(&cpp_field_surfaceId_abi, cpp_field_surfaceId_len + 1);
    NAPI_CALL(env, napi_get_value_string_utf8(env, napi_field_surfaceId, cpp_field_surfaceId_buf, cpp_field_surfaceId_len + 1, &cpp_field_surfaceId_len));
    cpp_field_surfaceId_buf[cpp_field_surfaceId_len] = '\0';
    cpp_field_surfaceId_abi.length = cpp_field_surfaceId_len;
    taihe::string cpp_field_surfaceId(cpp_field_surfaceId_abi);
    return ::recorder::Response{std::move(cpp_field_code), std::move(cpp_field_surfaceId)};
}
inline napi_value recorder_Response_intoNAPI(napi_env env, ::recorder::Response const& cpp_obj) {
    napi_value napi_field_code = nullptr;
    NAPI_CALL(env, napi_create_int32(env, cpp_obj.code, &napi_field_code));
    napi_value napi_field_surfaceId = nullptr;
    NAPI_CALL(env, napi_create_string_utf8(env, cpp_obj.surfaceId.c_str(), cpp_obj.surfaceId.size(), &napi_field_surfaceId));
    napi_value args[2] = {napi_field_code, napi_field_surfaceId};
    napi_value napi_obj = nullptr, constructor = nullptr;
    NAPI_CALL(env, napi_get_reference_value(env, ctor_ref_recorder_Response_t_inner(), &constructor));
    NAPI_CALL(env, napi_new_instance(env, constructor, 2, args, &napi_obj));
    return napi_obj;
}
#pragma clang diagnostic pop
